public class Main {
    public static void main(String[] args) {
        int a=40;
        int b=20;
        int c=a%b;
        while(c!=0){
            a=b;
            b=c;                           //辗转相除法求两个整数的最大公约数
            c=a%b;
        }
        System.out.println(b);
    }
}
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) { // 注意 while 处理多个 case

            int n=in.nextInt();

            for(int i=0;i<n;i++){

                for(int j=0;j<n;j++){

                    if(i==j||(i+j)==n-1){

                        System.out.print("*");      //打印图形X

                    }

                    else{

                        System.out.printf(" ");

                    }

                }

                System.out.println();

            }

        }
    }
}
import java.util.Random;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Random random=new Random();
        Scanner sc=new Scanner(System.in);
        int guess= random.nextInt(100);
        while(true){
            System.out.println("请输入你要输入的数字：（1-100）");
            int num= sc.nextInt();
            if(num<guess){
                System.out.println("你猜小了");          //猜数字游戏
            } else if (num>guess) {
                System.out.println("你猜大了");
            }else{
                System.out.println("恭喜你，你猜对啦！");
                break;
            }
        }
        sc.close();
    }
}